package visitor;

import java.util.ArrayList;
import java.util.List;

public class Commande implements IVisitable {

	private String name;
	private List<Ligne> lignes = new ArrayList<Ligne>();
	
	public String getName() {
		return name;
	}

	public void addLigne(Ligne l) {
		this.lignes.add(l);
	}

	@Override
	public void accept(IVisitor visitor) {
		visitor.visit(this);
		for(Ligne l : lignes) {
			l.accept(visitor);
		}
	}
	
	public Commande(String name) {
		this.name = name;
	}
	
	public Commande(String name, String ligneName) {
		this.name = name;
		this.addLigne(new Ligne(ligneName));
	}
	
	public List<Ligne> getLignes(){
		return this.lignes;
	}
}
